import React, { memo, useEffect, useState } from "react";
import { View, Text } from '@tarojs/components'
import { Cell, Empty } from '@antmjs/vantui'
import { useRouter } from "@tarojs/taro";
import { formatDate } from "@/utils/fomatter"


import './index.scss'


function InviteDetail() {
  const router = useRouter()
  const [inviteList, setInviteList] = useState([])
  useEffect(() => {
    router.params?.data && setInviteList(JSON.parse(decodeURIComponent(router.params.data)))
  }, [router.params])
  return (
    <>
      <View className='my-cell padding_three'>
        <Text>UID</Text>
        <Text>时间</Text>
      </View>

      {
        inviteList.length ?
          <View className='detail-cell padding_three'>
            {
              inviteList.map((detail) => {
                return (
                  <Cell key={detail?.invitedUserId}
                    title={detail?.invitedUserId}
                    value={formatDate(detail?.created, null, 'YYYY/MM/DD')}
                    border={false}

                  />
                )
              })
            }
          </View>
          :
          <Empty
            image='https://static.hzddyy.com/taiyi/tt/public_placeholder_nodata.png'
            description='暂无数据'
          />
      }
    </>


  )
}

export default memo(InviteDetail)
